this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["reviews-by-product"]=function(e){function t(t){for(var o,a,s=t[0],i=t[1],l=t[2],u=0,b=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o]);for(d&&d(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,s=1;s<r.length;s++){var i=r[s];0!==n[i]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={53:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var d=i;return c.push([546,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.htmlEntities},102:function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var o=r(0),n=r(1),c=r(2),a=r(70),s=r(614),i=r(4),l=r.n(i),d=r(11),u=r(16),b=r(35),m=r(613),p=r(10);r(55);const w=({id:e,label:t,popoverContents:r,remove:s,screenReaderLabel:i,className:u=""})=>{const[b,g]=Object(o.useState)(!1),h=Object(d.useInstanceId)(w);if(i=i||t,!t)return null;t=Object(p.decodeEntities)(t);const v=l()("woocommerce-tag",u,{"has-remove":!!s}),O=`woocommerce-tag__label-${h}`,j=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},t));return Object(o.createElement)("span",{className:v},r?Object(o.createElement)(c.Button,{className:"woocommerce-tag__text",id:O,onClick:()=>g(!0)},j):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:O},j),r&&b&&Object(o.createElement)(c.Popover,{onClose:()=>g(!1)},r),s&&Object(o.createElement)(c.Button,{className:"woocommerce-tag__remove",onClick:s(e),label:Object(n.sprintf)(
// Translators: %s label.
Object(n.__)("Remove %s","woocommerce"),t),"aria-describedby":O},Object(o.createElement)(a.a,{icon:m.a,size:20,className:"clear-icon"})))};var g=w;r(54);const h=e=>Object(o.createElement)(b.b,{...e}),v=e=>{const{list:t,selected:r,renderItem:n,depth:c=0,onSelect:a,instanceId:s,isSingle:i,search:l,useExpandedPanelId:d}=e,[u]=d;return t?Object(o.createElement)(o.Fragment,null,t.map((t=>{var b,m;const p=null!==(b=t.children)&&void 0!==b&&b.length&&!i?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),w=(null===(m=t.children)||void 0===m?void 0:m.length)&&u===t.id;return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,n({item:t,isSelected:p,onSelect:a,isSingle:i,selected:r,search:l,depth:c,useExpandedPanelId:d,controlId:s})),w?Object(o.createElement)(v,{...e,list:t.children,depth:c+1}):null)}))):null},O=({isLoading:e,isSingle:t,selected:r,messages:a,onChange:s,onRemove:i})=>{if(e||t||!r)return null;const l=r.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,a.selected(l)),l>0?Object(o.createElement)(c.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":a.clear},Object(n.__)("Clear all","woocommerce")):null),l>0?Object(o.createElement)("ul",null,r.map(((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(g,{label:e.name,id:e.id,remove:i}))))):null)},j=({filteredList:e,search:t,onSelect:r,instanceId:c,useExpandedPanelId:i,...l})=>{const{messages:d,renderItem:u,selected:b,isSingle:m}=l,p=u||h;return 0===e.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(a.a,{icon:s.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?Object(n.sprintf)(d.noResults,t):d.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(v,{useExpandedPanelId:i,list:e,selected:b,renderItem:p,onSelect:r,instanceId:c,isSingle:m,search:t}))},_=e=>{const{className:t="",isCompact:r,isHierarchical:a,isLoading:s,isSingle:i,list:b,messages:m=u.a,onChange:p,onSearch:w,selected:g,type:h="text",debouncedSpeak:v}=e,[f,E]=Object(o.useState)(""),k=Object(o.useState)(-1),y=Object(d.useInstanceId)(_),R=Object(o.useMemo)((()=>({...u.a,...m})),[m]),S=Object(o.useMemo)((()=>Object(u.c)(b,f,a)),[b,f,a]);Object(o.useEffect)((()=>{v&&v(R.updated)}),[v,R]),Object(o.useEffect)((()=>{"function"==typeof w&&w(f)}),[f,w]);const C=Object(o.useCallback)((e=>()=>{i&&p([]);const t=g.findIndex((({id:t})=>t===e));p([...g.slice(0,t),...g.slice(t+1)])}),[i,g,p]),P=Object(o.useCallback)((e=>()=>{Array.isArray(e)?p(e):-1===g.findIndex((({id:t})=>t===e.id))?p(i?[e]:[...g,e]):C(e.id)()}),[i,C,p,g]),N=Object(o.useCallback)((e=>{const[t]=g.filter((t=>!e.find((e=>t.id===e.id))));C(t.id)()}),[C,g]);return Object(o.createElement)("div",{className:l()("woocommerce-search-list",t,{"is-compact":r,"is-loading":s,"is-token":"token"===h})},"text"===h&&Object(o.createElement)(O,{...e,onRemove:C,messages:R}),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},"text"===h?Object(o.createElement)(c.TextControl,{label:R.search,type:"search",value:f,onChange:e=>E(e)}):Object(o.createElement)(c.FormTokenField,{disabled:s,label:R.search,onChange:N,onInputChange:e=>E(e),suggestions:[],__experimentalValidateInput:()=>!1,value:s?[Object(n.__)("Loading…","woocommerce")]:g.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),s?Object(o.createElement)("div",{className:"woocommerce-search-list__list"},Object(o.createElement)(c.Spinner,null)):Object(o.createElement)(j,{...e,search:f,filteredList:S,messages:R,onSelect:P,instanceId:y,useExpandedPanelId:k}))};Object(c.withSpokenMessages)(_)},11:function(e,t){e.exports=window.wp.compose},110:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(260),a=r(35),s=r(102),i=r(11),l=r(218),d=r(18),u=r.n(d),b=r(25),m=r.n(b),p=r(23),w=r(28),g=Object(i.createHigherOrderComponent)((e=>{class t extends o.Component{constructor(...e){super(...e),u()(this,"state",{error:null,loading:!1,variations:{}}),u()(this,"loadVariations",(()=>{const{products:e}=this.props,{loading:t,variations:r}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||r[o])return;const n=e.find((e=>e.id===o));n.variations&&0!==n.variations.length?(this.setState({loading:!0}),Object(p.g)(o).then((e=>{const t=e.map((e=>({...e,parent:o})));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})})).catch((async e=>{const t=await Object(w.a)(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})}))):this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:null})}))}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:r,showVariations:o}=this.props;o&&(!m()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){var t;const{products:r}=this.props;return null===(t=r.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:r}=this.props;if(!r)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem)),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:r}=this.props,{error:n,loading:c,variations:a}=this.state;return Object(o.createElement)(e,{...this.props,error:n||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:a,variationsLoading:c})}}return u()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),h=r(34),v=r(4),O=r.n(v),j=r(73);r(155);const _={list:Object(n.__)("Products","woocommerce"),noItems:Object(n.__)("Your store doesn't have any products.","woocommerce"),search:Object(n.__)("Search for a product to display","woocommerce"),updated:Object(n.__)("Product search results updated.","woocommerce")},f=({expandedProduct:e,error:t,instanceId:r,isCompact:i,isLoading:l,onChange:d,onSearch:u,products:b,renderItem:m,selected:p,showVariations:w,variations:g,variationsLoading:v})=>{if(t)return Object(o.createElement)(h.a,{error:t});const f=[...b,...g&&g[e]?g[e]:[]];return Object(o.createElement)(s.a,{className:"woocommerce-products",list:f,isCompact:i,isLoading:l,isSingle:!0,selected:f.filter((({id:e})=>p.includes(e))),onChange:d,renderItem:m||(w?e=>{const{item:t,search:s,depth:i=0,isSelected:d,onSelect:u}=e,b=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=O()("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${i}`,"has-count",{"is-searching":s.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":b>0});if(!t.breadcrumbs.length)return Object(o.createElement)(j.a,{...e,className:O()(m,{"is-selected":d}),isSelected:d,item:t,onSelect:()=>()=>{u(t)()},isLoading:l||v,countLabel:t.variations.length>0?Object(n.sprintf)(/* translators: %1$d is the number of variations of a product product. */
Object(n.__)("%1$d variations","woocommerce"),t.variations.length):null,name:`products-${r}`,"aria-label":Object(n.sprintf)(/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
Object(n._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woocommerce"),t.name,t.variations.length)});const p=Object(c.a)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(o.createElement)(a.a,{...p,className:m,name:`variations-${r}`})}:null),onSearch:u,messages:_,isHierarchical:!0})};var E;f.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=(E=Object(l.a)(g(Object(i.withInstanceId)(f))),e=>{let{selected:t}=e;t=void 0===t?null:t;const r=null===t;return Array.isArray(t)?Object(o.createElement)(E,{...e}):Object(o.createElement)(E,{...e,selected:r?[]:[t]})})},124:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(3),s=r(2);const i=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(s.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Product rating","woocommerce"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(s.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woocommerce"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Reviewer name","woocommerce"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Image","woocommerce"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Review date","woocommerce"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Review content","woocommerce"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woocommerce"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(s.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woocommerce")}),Object(o.createElement)(s.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woocommerce")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(s.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woocommerce"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Order by","woocommerce"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(s.SelectControl,{label:Object(n.__)("Order Product Reviews by","woocommerce"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(s.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woocommerce"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(s.ToggleControl,{label:Object(n.__)("Load more","woocommerce"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(s.RangeControl,{label:Object(n.__)("Load More Reviews","woocommerce"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},131:function(e,t){},137:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(29),s=r(11);r(188),t.a=Object(s.withInstanceId)((({className:e,instanceId:t,label:r="",onChange:n,options:s,screenReaderLabel:i,value:l=""})=>{const d=`wc-block-components-sort-select__select-${t}`;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",e)},Object(o.createElement)(a.a,{label:r,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(o.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:n,value:l},s&&s.map((e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label)))))}))},14:function(e,t){e.exports=window.wp.apiFetch},143:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(17);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woocommerce"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woocommerce"),product_permalink:"#",
/* translators: An example person name used for the block previews. */
reviewer:Object(o.__)("Alice","woocommerce"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woocommerce")}</p>\n`,reviewer_avatar_urls:{48:n.p.defaultAvatar,96:n.p.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woocommerce"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woocommerce"),product_permalink:"#",
/* translators: An example person name used for the block previews. */
reviewer:Object(o.__)("Bob","woocommerce"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woocommerce")}</p>\n`,reviewer_avatar_urls:{48:n.p.defaultAvatar,96:n.p.defaultAvatar},rating:null,verified:!1}]}}},15:function(e,t){e.exports=window.wp.url},155:function(e,t){},16:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"d",(function(){return l})),r.d(t,"b",(function(){return d}));var o=r(0),n=r(1),c=r(57);const a={clear:Object(n.__)("Clear all selected items","woocommerce"),noItems:Object(n.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:Object(n.__)("No results for %s","woocommerce"),search:Object(n.__)("Search for items","woocommerce"),selected:e=>Object(n.sprintf)(/* translators: Number of items selected from list. */
Object(n._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:Object(n.__)("Search results updated.","woocommerce")},s=(e,t=e)=>{const r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),o=Object(c.a)(t,"id"),n=["0"],a=(e={})=>e.parent?[...a(o[e.parent]),e.name]:e.name?[e.name]:[],s=e=>e.map((e=>{const t=r[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(o[e.parent]),children:t&&t.length?s(t):[]}})),i=s(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{n.includes(e)||i.push(...s(t||[]))})),i},i=(e,t,r)=>{if(!t)return r?s(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),n=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?s(n,e):n},l=(e,t)=>{if(!t)return e;const r=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(r).map(((e,t)=>r.test(e)?Object(o.createElement)("strong",{key:t},e):Object(o.createElement)(o.Fragment,{key:t},e)))},d=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},168:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},169:function(e,t,r){"use strict";var o=r(0),n=r(5),c=(r(189),r(67));t.a=({attributes:e})=>Object(o.createElement)("div",{...n.useBlockProps.save({className:Object(c.a)(e)}),...Object(c.b)(e)})},17:function(e,t,r){"use strict";r.d(t,"p",(function(){return c})),r.d(t,"n",(function(){return a})),r.d(t,"m",(function(){return s})),r.d(t,"o",(function(){return i})),r.d(t,"k",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"h",(function(){return u})),r.d(t,"l",(function(){return b})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return p})),r.d(t,"g",(function(){return w})),r.d(t,"a",(function(){return v})),r.d(t,"b",(function(){return O})),r.d(t,"i",(function(){return j})),r.d(t,"j",(function(){return _})),r.d(t,"f",(function(){return f}));var o,n=r(3);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",s=c.pluginUrl+"build/",i=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=(n.STORE_PAGES.checkout.permalink,n.STORE_PAGES.privacy.permalink),b=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),m=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),p=n.STORE_PAGES.cart.permalink,w=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("localPickupEnabled",!1)),g=Object(n.getSetting)("countries",{}),h=Object(n.getSetting)("countryData",{}),v=Object.fromEntries(Object.keys(h).filter((e=>!0===h[e].allowBilling)).map((e=>[e,g[e]||""]))),O=Object.fromEntries(Object.keys(h).filter((e=>!0===h[e].allowBilling)).map((e=>[e,h[e].states||[]]))),j=Object.fromEntries(Object.keys(h).filter((e=>!0===h[e].allowShipping)).map((e=>[e,g[e]||""]))),_=Object.fromEntries(Object.keys(h).filter((e=>!0===h[e].allowShipping)).map((e=>[e,h[e].states||[]]))),f=Object.fromEntries(Object.keys(h).map((e=>[e,h[e].locale||[]])))},175:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(289),a=r(2),s=r(5),i=r(3),l=r(88),d=r(29);r(223);var u=({onClick:e,label:t=Object(n.__)("Load more","woocommerce"),screenReaderLabel:r=Object(n.__)("Load more","woocommerce")})=>Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:e},Object(o.createElement)(d.a,{label:t,screenReaderLabel:r}))),b=r(137);r(220);var m=({onChange:e,readOnly:t,value:r})=>Object(o.createElement)(b.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woocommerce"),onChange:e,options:[{key:"most-recent",label:Object(n.__)("Most recent","woocommerce")},{key:"highest-rating",label:Object(n.__)("Highest rating","woocommerce")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woocommerce")}],readOnly:t,screenReaderLabel:Object(n.__)("Order reviews by","woocommerce"),value:r}),p=r(4),w=r.n(p),g=r(18),h=r.n(g),v=r(208),O=r.n(v);const j=(e,t,r="...")=>O()(e,{suffix:r,limit:t}).html,_=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),f=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=_(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},E={className:"read-more-content",ellipsis:"&hellip;",lessText:Object(n.__)("Read less","woocommerce"),maxLines:3,moreText:Object(n.__)("Read more","woocommerce")};class k extends o.Component{constructor(e){super(e),h()(this,"reviewSummary",void 0),h()(this,"reviewContent",void 0),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(o.createRef)(),this.reviewSummary=Object(o.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:f(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}h()(k,"defaultProps",E);var y=k;r(222);var R=({attributes:e,review:t={}})=>{const{imageType:r,showReviewDate:c,showReviewerName:a,showReviewImage:s,showReviewRating:i,showReviewContent:l,showProductName:d}=e,{rating:u}=t,b=!(Object.keys(t).length>0),m=Number.isFinite(u)&&i;return Object(o.createElement)("li",{className:w()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":b,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":b},(d||c||a||s||m)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woocommerce")},Object(n.__)("Verified buyer","woocommerce")))}(t,r,b),(d||a||m||c)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},m&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(/* translators: %f is referring to the average rating value */
Object(n.__)("Rated %f out of 5","woocommerce"),t),a={__html:Object(n.sprintf)(/* translators: %s is referring to the average rating value */
Object(n.__)("Rated %s out of 5","woocommerce"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(t),d&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(t),a&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(t),c&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(t))),l&&function(e){return Object(o.createElement)(y,{maxLines:10,moreText:Object(n.__)("Read full review","woocommerce"),lessText:Object(n.__)("Hide full review","woocommerce"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(t))};r(221);var S=({attributes:e,reviews:t})=>{const r=Object(i.getSetting)("showAvatars",!0),n=Object(i.getSetting)("reviewRatingsEnabled",!0),c=(r||"product"===e.imageType)&&e.showReviewImage,a=n&&e.showReviewRating,s={...e,showReviewImage:c,showReviewRating:a};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===t.length?Object(o.createElement)(R,{attributes:s}):t.map(((e,t)=>Object(o.createElement)(R,{key:e.id||t,attributes:s,review:e}))))},C=r(25),P=r.n(C),N=r(67),I=r(28);class x extends o.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:s,totalReviews:d}=this.props;if(t)return Object(o.createElement)(l.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.length&&!r)return Object(o.createElement)(c,{attributes:e});const b=Object(i.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&b&&Object(o.createElement)(m,{readOnly:!0,value:e.orderby,onChange:()=>null}),Object(o.createElement)(S,{attributes:e,reviews:s}),e.showLoadMore&&d>s.length&&Object(o.createElement)(u,{screenReaderLabel:Object(n.__)("Load more reviews","woocommerce")}))}}var L=(e=>{class t extends o.Component{constructor(...e){super(...e),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(this,"setError",(async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(I.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)}))}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!P()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(e=[]){const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(N.c)(this.getArgs(e.length)).then((({reviews:t,totalReviews:r})=>(this.isMounted&&this.setState({reviews:e.filter((e=>Object.keys(e).length)).concat(t),totalReviews:r,loading:!1,error:null}),{newReviews:t}))).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,{...this.props,error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a})}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(x);t.a=({attributes:e,icon:t,name:r,noReviewsPlaceholder:i})=>{const{categoryIds:l,productId:d,reviewsOnPageLoad:u,showProductName:b,showReviewDate:m,showReviewerName:p,showReviewContent:w,showReviewImage:g,showReviewRating:h}=e,{order:v,orderby:O}=Object(N.d)(e.orderby),j=!(w||h||m||p||g||b),_=Object(s.useBlockProps)({className:Object(N.a)(e)});return j?Object(o.createElement)(a.Placeholder,{icon:t,label:r},Object(n.__)("The content for this block is hidden due to block settings.","woocommerce")):Object(o.createElement)("div",{..._},Object(o.createElement)(L,{attributes:e,categoryIds:l,delayFunction:e=>Object(c.a)(e,400),noReviewsPlaceholder:i,orderby:O,order:v,productId:d,reviewsToDisplay:u}))}},188:function(e,t){},189:function(e,t){},2:function(e,t){e.exports=window.wp.components},218:function(e,t,r){"use strict";var o=r(0),n=r(17),c=r(23),a=r(41),s=r(28);t.a=e=>({selected:t,...r})=>{const[i,l]=Object(o.useState)(!0),[d,u]=Object(o.useState)(null),[b,m]=Object(o.useState)([]),p=n.p.productCount>100,w=async e=>{const t=await Object(s.a)(e);u(t),l(!1)},g=Object(o.useRef)(t);Object(o.useEffect)((()=>{Object(c.h)({selected:g.current}).then((e=>{m(e),l(!1)})).catch(w)}),[g]);const h=Object(a.b)((e=>{Object(c.h)({selected:t,search:e}).then((e=>{m(e),l(!1)})).catch(w)}),400),v=Object(o.useCallback)((e=>{l(!0),h(e)}),[l,h]);return Object(o.createElement)(e,{...r,selected:t,error:d,products:b,isLoading:i,onSearch:p?v:null})}},220:function(e,t){},221:function(e,t){},222:function(e,t){},223:function(e,t){},23:function(e,t,r){"use strict";r.d(t,"h",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"b",(function(){return u})),r.d(t,"i",(function(){return b})),r.d(t,"f",(function(){return m})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return w})),r.d(t,"g",(function(){return g})),r.d(t,"a",(function(){return h}));var o=r(15),n=r(14),c=r.n(n),a=r(3),s=r(17);const i=(e,t)=>{const r=new Map;return e.filter((e=>{const o=t(e);return!r.has(o)&&(r.set(o,e),!0)}))},l=({selected:e=[],search:t="",queryArgs:r={}})=>{const n=(({selected:e=[],search:t="",queryArgs:r={}})=>{const n=s.p.productCount>100,c={per_page:n?100:0,catalog_visibility:"any",search:t,orderby:"title",order:"asc"},a=[Object(o.addQueryArgs)("/wc/store/v1/products",{...c,...r})];return n&&e.length&&a.push(Object(o.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:0})),a})({selected:e,search:t,queryArgs:r});return Promise.all(n.map((e=>c()({path:e})))).then((e=>{const t=e.flat();return i(t,(e=>e.id)).map((e=>({...e,parent:0})))})).catch((e=>{throw e}))},d=e=>c()({path:`/wc/store/v1/products/${e}`}),u=()=>c()({path:"wc/store/v1/products/attributes"}),b=e=>c()({path:`wc/store/v1/products/attributes/${e}/terms`}),m=({selected:e=[],search:t})=>{const r=(({selected:e=[],search:t})=>{const r=Object(a.getSetting)("limitTags",!1),n=[Object(o.addQueryArgs)("wc/store/v1/products/tags",{per_page:r?100:0,orderby:r?"count":"name",order:r?"desc":"asc",search:t})];return r&&e.length&&n.push(Object(o.addQueryArgs)("wc/store/v1/products/tags",{include:e})),n})({selected:e,search:t});return Promise.all(r.map((e=>c()({path:e})))).then((e=>{const t=e.flat();return i(t,(e=>e.id))}))},p=e=>c()({path:Object(o.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),w=e=>c()({path:`wc/store/v1/products/categories/${e}`}),g=e=>c()({path:Object(o.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),h=(e,t)=>{if(!e.title.raw)return e.slug;const r=1===t.filter((t=>t.title.raw===e.title.raw)).length;return e.title.raw+(r?"":` - ${e.slug}`)}},25:function(e,t){e.exports=window.wp.isShallowEqual},26:function(e,t){e.exports=window.React},260:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));const o=e=>null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));const o=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}}},289:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));const o=(e,t,r)=>{let o,n=null;const c=(...c)=>{n=c,o&&clearTimeout(o),o=setTimeout((()=>{o=null,!r&&n&&e(...n)}),t),r&&!o&&e(...c)};return c.flush=()=>{o&&n&&(e(...n),clearTimeout(o),o=null)},c}},29:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=({label:e,screenReaderLabel:t,wrapperElement:r,wrapperProps:n={}})=>{let a;const s=null!=e,i=null!=t;return!s&&i?(a=r||"span",n={...n,className:c()(n.className,"screen-reader-text")},Object(o.createElement)(a,{...n},t)):(a=r||o.Fragment,s&&i&&e!==t?Object(o.createElement)(a,{...n},Object(o.createElement)("span",{"aria-hidden":"true"},e),Object(o.createElement)("span",{className:"screen-reader-text"},t)):Object(o.createElement)(a,{...n},e))}},3:function(e,t){e.exports=window.wc.wcSettings},31:function(e,t){e.exports=window.wp.escapeHtml},34:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(31);t.a=({error:e})=>Object(o.createElement)("div",{className:"wc-block-error-message"},(({message:e,type:t})=>e?"general"===t?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woocommerce"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(e))):"api"===t?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woocommerce"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(e))):e:Object(n.__)("An error has prevented the block from being updated.","woocommerce"))(e))},35:function(e,t,r){"use strict";r.d(t,"a",(function(){return b}));var o=r(0),n=r(4),c=r.n(n),a=r(2);function s(e,t,r){const o=new Set(t.map((e=>e[r])));return e.filter((e=>!o.has(e[r])))}var i=r(10),l=r(16);const d=({label:e})=>Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},e),u=e=>{const{item:t,search:r}=e,n=t.breadcrumbs&&t.breadcrumbs.length;return Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},n?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(t.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(Object(i.decodeEntities)(t.name),r)))},b=({countLabel:e,className:t,depth:r=0,controlId:n="",item:b,isSelected:m,isSingle:p,onSelect:w,search:g="",selected:h,useExpandedPanelId:v,...O})=>{var j,_;const[f,E]=v,k=null!=e&&void 0!==b.count&&null!==b.count,y=!(null===(j=b.breadcrumbs)||void 0===j||!j.length),R=!(null===(_=b.children)||void 0===_||!_.length),S=f===b.id,C=c()(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":y,"has-children":R,"has-count":k,"is-expanded":S,"is-radio-button":p}),P=O.name||`search-list-item-${n}`,N=`${P}-${b.id}`,I=Object(o.useCallback)((()=>{E(S?-1:Number(b.id))}),[S,b.id,E]);return R?Object(o.createElement)("div",{className:C,onClick:I,onKeyDown:e=>"Enter"===e.key||" "===e.key?I():null,role:"treeitem",tabIndex:0},p?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("input",{type:"radio",id:N,name:P,value:b.value,onChange:w(b),onClick:e=>e.stopPropagation(),checked:m,className:"woocommerce-search-list__item-input",...O}),Object(o.createElement)(u,{item:b,search:g}),k?Object(o.createElement)(d,{label:e||b.count}):null):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(a.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:m,...!m&&b.children.some((e=>h.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:Object(l.d)(Object(i.decodeEntities)(b.name),g),onChange:()=>{m?w(s(h,b.children,"id"))():w(function(e,t,r){const o=s(t,e,"id");return[...e,...o]}(h,b.children))()},onClick:e=>e.stopPropagation()}),k?Object(o.createElement)(d,{label:e||b.count}):null)):Object(o.createElement)("label",{htmlFor:N,className:C},p?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("input",{type:"radio",id:N,name:P,value:b.value,onChange:w(b),checked:m,className:"woocommerce-search-list__item-input",...O}),Object(o.createElement)(u,{item:b,search:g})):Object(o.createElement)(a.CheckboxControl,{id:N,name:P,className:"woocommerce-search-list__item-input",value:Object(i.decodeEntities)(b.value),label:Object(l.d)(Object(i.decodeEntities)(b.name),g),onChange:w(b),checked:m,...O}),k?Object(o.createElement)(d,{label:e||b.count}):null)};t.b=b},373:function(e,t,r){"use strict";var o=r(18),n=r.n(o),c=r(0),a=r(11),s=r(23),i=r(28);const l=Object(a.createHigherOrderComponent)((e=>class extends c.Component{constructor(...e){super(...e),n()(this,"state",{error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null}),n()(this,"loadProduct",(()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),Object(s.e)(e).then((e=>{this.setState({product:e,loading:!1,error:null})})).catch((async e=>{const t=await Object(i.a)(e);this.setState({product:null,loading:!1,error:t})}))):this.setState({product:null,loading:!1,error:null}))}))}componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}render(){const{error:t,loading:r,product:o}=this.state;return Object(c.createElement)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:r,product:o})}}),"withProduct");t.a=l},5:function(e,t){e.exports=window.wp.blockEditor},54:function(e,t){},546:function(e,t,r){e.exports=r(591)},55:function(e,t){},57:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));const o=(e,t)=>e.reduce(((e,r)=>(e[String(t?r[t]:r)]=r,e)),{})},591:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(7),a=r(70),s=r(275),i=(r(189),r(5)),l=r(2),d=r(35),u=r(110),b=r(175),m=r(88),p=r(373),w=r(10),g=Object(p.a)((({error:e,getProduct:t,isLoading:r,product:c})=>{if(e)return Object(o.createElement)(m.a,{className:"wc-block-featured-product-error",error:e,isLoading:r,onRetry:t});const i=!c||r?Object(o.createElement)(l.Spinner,null):Object(n.sprintf)(/* translators: %s is the product name. */
Object(n.__)("This block lists reviews for a selected product. %s doesn't have any reviews yet, but they will show up here when it does.","woocommerce"),Object(w.decodeEntities)(c.name));return Object(o.createElement)(l.Placeholder,{className:"wc-block-reviews-by-product",icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),label:Object(n.__)("Reviews by Product","woocommerce")},i)})),h=r(124),v=Object(l.withSpokenMessages)((({attributes:e,debouncedSpeak:t,setAttributes:r})=>{const{editMode:c,productId:m}=e,p=e=>{const{item:t=0}=e;return Object(o.createElement)(d.a,{...e,countLabel:Object(n.sprintf)(/* translators: %d is the review count. */
Object(n._n)("%d review","%d reviews",t.review_count,"woocommerce"),t.review_count),"aria-label":Object(n.sprintf)(/* translators: %1$s is the item name, and %2$d is the number of reviews for the item. */
Object(n._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,"woocommerce"),t.name,t.review_count)})};if(!m||c)return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),label:Object(n.__)("Reviews by Product","woocommerce"),className:"wc-block-reviews-by-product"},Object(n.__)("Show reviews of your product to build trust","woocommerce"),Object(o.createElement)("div",{className:"wc-block-reviews__selection"},Object(o.createElement)(u.a,{selected:e.productId||0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;r({productId:t})},queryArgs:{orderby:"comment_count",order:"desc"},renderItem:p}),Object(o.createElement)(l.Button,{isPrimary:!0,onClick:()=>{r({editMode:!1}),t(Object(n.__)("Showing Reviews by Product block preview.","woocommerce"))}},Object(n.__)("Done","woocommerce"))));const w=Object(n.__)("Edit selected product","woocommerce");return Object(o.createElement)(o.Fragment,null,Object(h.a)(c,r,w),Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Product","woocommerce"),initialOpen:!1},Object(o.createElement)(u.a,{selected:e.productId||0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;r({productId:t})},renderItem:p,isCompact:!0})),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woocommerce")},Object(h.b)(e,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woocommerce")},Object(h.c)(e,r))),Object(o.createElement)(b.a,{attributes:e,icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),name:Object(n.__)("Reviews by Product","woocommerce"),noReviewsPlaceholder:g}))})),O=r(168),j=r(169),_=r(143);Object(c.registerBlockType)("woocommerce/reviews-by-product",{apiVersion:2,title:Object(n.__)("Reviews by Product","woocommerce"),icon:{src:Object(o.createElement)(a.a,{icon:s.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woocommerce")],description:Object(n.__)("Display reviews for your products.","woocommerce"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{..._.a,attributes:{..._.a.attributes,productId:1}},attributes:{...O.a,productId:{type:"number"}},edit:e=>Object(o.createElement)(v,{...e}),save:j.a})},67:function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(14),n=r.n(o),c=r(4),a=r.n(c),s=r(3);const i=e=>{if(Object(s.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map((e=>e.join("="))).join("&"),parse:!1}).then((e=>e.json().then((t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:s,showProductName:i,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":s,"has-product-name":i})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:s,showOrderby:i}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":s,"data-show-orderby":i};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},7:function(e,t){e.exports=window.wp.blocks},73:function(e,t,r){"use strict";var o=r(0),n=r(2),c=r(35),a=r(4),s=r.n(a);t.a=({className:e,item:t,isSelected:r,isLoading:a,onSelect:i,disabled:l,...d})=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.a,{...d,key:t.id,className:e,isSelected:r,item:t,onSelect:i,disabled:l}),r&&a&&Object(o.createElement)("div",{key:"loading",className:s()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(o.createElement)(n.Spinner,null)))},88:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(70),a=r(212),s=r(4),i=r.n(s),l=r(2),d=r(34);r(131),t.a=({className:e,error:t,isLoading:r=!1,onRetry:s})=>Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woocommerce"),className:i()("wc-block-api-error",e)},Object(o.createElement)(d.a,{error:t}),s&&Object(o.createElement)(o.Fragment,null,r?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:s},Object(n.__)("Retry","woocommerce"))))},9:function(e,t){e.exports=window.wp.primitives}});